def matches(dev, mode) :
    return dev == "tracker" and mode != "none"

def handler(self, event) :
    if event["sensor"] == 0 : # head
        self.wand_matrix = osg.Matrixd()
        self.wand_matrix.setRotate(
            apply(osg.Quat, event["data"]["quat"])
        )
        self.wand_matrix.postMult(
            osg.Matrixd.rotate(math.radians(90), 0, 0, -1)
        )
        self.wand_matrix.postMult(
            osg.Matrixd.rotate(math.radians(90), -1, 0, 0)
        )
        #if event["sensor"] == 1 : # wand
        self.wand_matrix.setTrans(
            apply(osg.Vec3d, event["data"]["pos"])
        )

